package org.fisco.bcos.asset.controller;



import java.math.BigInteger;

import org.fisco.bcos.asset.resp.DonorRecord;
import org.fisco.bcos.asset.service.DonorService;
import org.fisco.bcos.sdk.model.TransactionReceipt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/donor")
public class DonorController {

    @Autowired
    private DonorService donorService;
    // 捐赠
    @PostMapping("/project/{projectId}/donate")
    public DonorRecord donate(
            @PathVariable BigInteger projectId,
            @RequestParam BigInteger amount) {
        return donorService.donate(projectId, amount);
    }
    // 查询捐赠金额
    @GetMapping("/project/{projectId}/donation/{donorAddress}")
    public BigInteger getDonationAmount(
            @PathVariable BigInteger projectId,
            @PathVariable String donorAddress) {
        return donorService.getDonationAmount(projectId, donorAddress);
    }
}